<if condition="$_SESSION['isEdit'] gt 0 && !isset($_GET['view'])">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Admin/js/artDialog/skins/default.css">
<script src="__PUBLIC__/Admin/js/artDialog/artDialog.js"></script>
<script src="__PUBLIC__/Admin/js/artDialog/plugins/iframeTools.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/ichsmart/jquery-ichsmart.css"/>
<script type="text/javascript" src="__PUBLIC__/Js/ichsmart/jquery.ichsmart.js"></script>
<script type="text/javascript" src="__PUBLIC__/Js/Gridly/javascripts/jquery.gridly.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Js/Gridly/stylesheets/jquery.gridly.css"/>


<script>




var mydialog = art.dialog;
$(document).ready(function(e) {
	
    $('.viewEditBox').each(function(index, element) {

  

		
		
	$(this).mouseleave(function(e) {
        $(this).find('.addModulesbtn').hide();
    });
	
	
	$(this).mouseenter(function(e) {
        $(this).find('.addModulesbtn').show();
    });
    $(this).smartedit({
		title:$(this).attr('title'),
		//编辑
		edit:function(){
			mydialog.open($(element).attr('editUrl'), {width: '100%', height: '100%',lock:true,title:'编辑'});
		},
		//设置 
		setting:function(){
			mydialog.open($(element).attr('settingUrl'), {width: '100%', height: '100%',lock:true,title:'设置模块'});
		},
		isEdit:$(element).attr('isEdit'),
		//删除模块
		close:function(){
			if(!confirm('删除模块后无法恢复,确定吗?')){
				return false;
			}
			$.get($(element).attr('deleteUrl'),{},function(data){
				if(data.status ){
					$(element).animate({height:'0px'},'','',function(){
						$(element).remove();
					});
				}else{
					alert(data.info);
				}
			},'json');
		},
		sortup:function(){
			$(element).after($(element).prev('div.viewEditBox'));
			updateModulesSort();
		},
		sortdown:function(){
			$(element).next('div.viewEditBox').after($(element));
			updateModulesSort();
		}
	});
});
});

function updateModulesSort(){
	var sortstr = new Array();
	$('.demo .viewEditBox').each(function(index, element) {
		if($(this).attr('modulesID')*1>0){
		$(this).attr('sortID',index);
        sortstr.push($(this).attr('modulesID')+'_'+$(this).attr('sortID'));
		}
    });
	$.post('{:U('/Admin/Modules/dosort')}',{'sort':sortstr.toString(),'field':'sort'},function(data){
		if(data=='OK'){
			
		}else{
			error('更新失败');
		}
	});
}
</script> 

</if>